package com.coolgor.coldot.enums.auth;

public enum LoginStateEnum {
	SUCCESS(1000, "操作成功"), 
	LOGINSUCCESS(1001, "登录成功"), 
	INNER_ERROR(-1000, "内部错误"), 
	PASSWORDERRER(-1001, "密码错误"), 
	DENIAL(-1002, "限制登录"), 
	WEB(2001, "网页"), 
	MOBILEPHONE(2002, "移动电话"), 
	PAD(2003, "平板电脑"), 
	WECHAT(2004, "微信"),
	WECHAT_QYH(2005, "微信企业号"),
	WECHAT_FWH(2006, "微信服务号"),
	WECHAT_JYH(2007, "微信订阅号"),
	WECHAT_MINIAPP(2008, "微信小程序"),
	UNKNOWNERRER(-9999, "未知错误");

	private int state;

	private String stateInfo;

	private LoginStateEnum(int state, String stateInfo) {
		this.state = state;
		this.stateInfo = stateInfo;
	}

	public int getState() {
		return state;
	}

	public String getStateInfo() {
		return stateInfo;
	}

	public static LoginStateEnum stateOf(int index) {
		for (LoginStateEnum state : values()) {
			if (state.getState() == index) {
				return state;
			}
		}
		return null;
	}
}
